package utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class BasicFileReader {
	
	BufferedReader reader;
	
	public BasicFileReader(String filename){
		try {
			reader=new BufferedReader(new java.io.FileReader(new File(filename)));
		} catch (FileNotFoundException e) {
			//e.printStackTrace();
			reader=null;
		}
	}
	
	/**
	 * @return null if file cannot be read or if there are no more strings
	 */
	public String readLine(){
		if(reader==null)
			return null;
		try {
			return reader.readLine();
		} catch (IOException e) {
			return null;
		}
	}
	
	public void close(){
		if(reader!=null)
			try {
				reader.close();
			} catch (IOException e) {
			}
	}
}
